﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.ServiceModel;

namespace ISSMoviePlex.Service
{
    [ServiceContract]
    public interface IMovieService
    {
        [OperationContract]
        [FaultContract(typeof(AuthorizationFault))]
        MovieCollection GetAllMovies();

        [OperationContract]
        [FaultContract(typeof(AuthorizationFault))]
        MovieCollection GetMovieByGenre(string genre);

        [OperationContract]
        [FaultContract(typeof(AuthorizationFault))]
        MovieCollection SearchMovieByTitle(string title);

        [OperationContract]
        [FaultContract(typeof(AuthorizationFault))]
        MovieInSoap GetAllMovieInSoap();
    }

    [CollectionDataContract]
    public class MovieCollection : List<Movie>
    {

    }

    [DataContract]
    public class Movie
    {
        [DataMember]
        public int MovieId;
        [DataMember]
        public string MovieName;
        [DataMember]
        public string MovieCast { get; set; }
        [DataMember]
        public string MoviePlot { get; set; }
        [DataMember]
        public string MovieLanguage { get; set; }
    }

    [MessageContract]
    public class MovieInSoap
    {
        [MessageHeader] public DateTime MsgTime = DateTime.Now;
        [MessageBodyMember] public List<Movie> Movies;
    }

}
